package com.atguigu.excel.write;

import com.alibaba.excel.EasyExcel;
import com.atguigu.excel.Stu;

import java.util.ArrayList;
import java.util.List;

public class WriteExcel {
    public static void main(String[] args) {
        //设置excel路径和名称
        String fileName ="D://0419.xlsx";
        //调方法
        EasyExcel.write(fileName, Stu.class).sheet("写入数据").doWrite(getData());
    }

    public static List<Stu> getData(){
        List<Stu> list = new ArrayList<Stu>();
        for (int i = 0; i < 10; i++) {
            Stu data = new Stu();
            data.setSno(i);
            data.setSname("张三"+i);
            list.add(data);
        }
        return list;
    }

}
